﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;


namespace sqxt
{
    public partial class personfile : Form
    {
        public personfile()
        {
            InitializeComponent();
        }
        string heno = "";
        public personfile(string no)
        {

            InitializeComponent();
            heno = no;
        }
        public personfile(bool ck, string no)
        {
            InitializeComponent();
            chakan = ck;
            heno = no;
        }
        SqlConnection conn = new SqlConnection(Dbconnect.s1);
        //bool chuanjian = false;
        bool chakan = false;
        string isend = "";
        private void personfile_Load(object sender, EventArgs e)
        {
            try
            {
                SqlCommand com;
                string sql = "select person_name,person_sex,person_birthdate,person_idtype,person_id_no,person_family_tel,person_nation,person_livetype  from person  where person_healthfile_no='" + heno + "'";
                conn.Open();
                com = new SqlCommand(sql, conn);
                SqlDataReader sdr1 = com.ExecuteReader();
                sdr1.Read();
                textBox2.Text = heno;
                textBox13.Text = sdr1["person_name"].ToString();
                textBox1.Text = sdr1[1].ToString();
                textBox4.Text = sdr1[2].ToString();
                if (sdr1[3].ToString() == "身份证") { textBox3.Text = sdr1[4].ToString(); }
                textBox8.Text = sdr1[5].ToString();
                textBox12.Text = sdr1[6].ToString();
                comboBox6.Text = sdr1["person_livetype"].ToString();
                conn.Close();
                sdr1.Close();

                #region  读出是否归档
                conn.Open();
                com = new SqlCommand("select * from person" + "  where  person_healthfile_no='" + heno + "'", conn);
                SqlDataReader sdrzt = com.ExecuteReader();
                sdrzt.Read();
                {
                    isend = sdrzt["person_isend"].ToString().Trim();
                }
                conn.Close();
                sdrzt.Close();
                #endregion



            if (chakan)
            {
                SqlCommand sc;
                SqlDataReader sdr;
                conn.Open();
                sc = new SqlCommand("select * from person" + "  where  person_healthfile_no='"+heno+"'", conn);
                sdr = sc.ExecuteReader();
                sdr.Read();
                {
                    comboBox4.Text = sdr["person_blood"].ToString();
                    textBox7.Text = sdr["person_tel"].ToString();
                    textBox8.Text = sdr["person_contact"].ToString();
                    textBox10.Text = sdr["person_contact_tel"].ToString();
                    comboBox1.Text = sdr["person_education"].ToString();
                    comboBox2.Text = sdr["person_vocation"].ToString();
                    comboBox3.Text = sdr["person_marryage"].ToString();
                    comboBox5.Text = sdr["Person_rh"].ToString();

                }
                conn.Close();
                sdr.Close();

                conn.Open();
                sc = new SqlCommand("select * from personfile1" + "  where  person_healthfile_no='" + heno + "'", conn);
                sdr = sc.ExecuteReader();
                sdr.Read();
                {
                    textBox5.Text = sdr["jzzh"].ToString();
                    textBox6.Text = sdr["gzdw"].ToString();
                    checkBox1.Checked = (bool)sdr["czzgjbyl"];
                    checkBox2.Checked = (bool)sdr["czjmjbyl"];
                    checkBox3.Checked = (bool)sdr["xxnchzyl"];
                    checkBox4.Checked = (bool)sdr["pkjz"];
                    checkBox5.Checked = (bool)sdr["syylbx"];
                    checkBox6.Checked = (bool)sdr["qgf"];
                    checkBox7.Checked = (bool)sdr["qzf"];
                    checkBox8.Checked = (bool)sdr["qt"];
                    textBox15.Text = sdr["qt_nr"].ToString();
                    radioButton3.Checked = (bool)sdr["ywgmw"];
                    radioButton4.Checked = (bool)sdr["ywgmy"];
                    checkBox10.Checked = (bool)sdr["ywgmqms"];
                    checkBox11.Checked = (bool)sdr["ywgmha"];
                    checkBox12.Checked = (bool)sdr["ywgmlms"];
                    checkBox13.Checked = (bool)sdr["ywgmqt"];
                    textBox15.Text = sdr["ywgmqt_nr"].ToString();

                }
                conn.Close();
                sdr.Close();
                conn.Open();
                sc = new SqlCommand("select * from personfile2" + "  where  person_healthfile_no='" + heno + "'", conn);
                sdr = sc.ExecuteReader();
                sdr.Read();
                {
                    radioButton6.Checked = (bool)sdr["jbw"];
                    radioButton7.Checked = (bool)sdr["jby"];
                    radioButton8.Checked = (bool)sdr["gxyw"];
                    radioButton10.Checked = (bool)sdr["gxyy"];
                    radioButton13.Checked = (bool)sdr["tnbw"];
                    radioButton11.Checked = (bool)sdr["tnby"];
                    radioButton16.Checked = (bool)sdr["gxbw"];
                    radioButton15.Checked = (bool)sdr["gxby"];
                    radioButton19.Checked = (bool)sdr["mxzsxfyw"];
                    radioButton18.Checked = (bool)sdr["mxzsxfyy"];
                    radioButton22.Checked = (bool)sdr["exzlw"];
                    radioButton21.Checked = (bool)sdr["exzly"];
                    radioButton25.Checked = (bool)sdr["nzzw"];
                    radioButton24.Checked = (bool)sdr["nzzy"];
                    radioButton28.Checked = (bool)sdr["zxjsbw"];
                    radioButton27.Checked = (bool)sdr["zxjsby"];
                    radioButton31.Checked = (bool)sdr["jhbw"];
                    radioButton30.Checked = (bool)sdr["jhby"];
                    radioButton34.Checked = (bool)sdr["gyw"];
                    radioButton33.Checked = (bool)sdr["gyy"];
                    radioButton37.Checked = (bool)sdr["qtfdcybw"];
                    radioButton36.Checked = (bool)sdr["qtfdcyby"];
                    radioButton40.Checked = (bool)sdr["qtw"];
                    radioButton39.Checked = (bool)sdr["qty"];
                    radioButton41.Checked = (bool)sdr["ssw"];
                    radioButton42.Checked = (bool)sdr["ssy"];
                    radioButton44.Checked = (bool)sdr["wsw"];
                    radioButton43.Checked = (bool)sdr["wsy"];
                    radioButton46.Checked = (bool)sdr["sxw"];
                    radioButton45.Checked = (bool)sdr["sxy"];

                }
                conn.Close();
                sdr.Close();
                conn.Open();
                sc = new SqlCommand("select * from personfile3" + "  where  person_healthfile_no='" + heno + "'", conn);
                sdr = sc.ExecuteReader();
                sdr.Read();
                {
                    dateTimePicker3.Value =DateTime.Parse( sdr["tnbqzsj"].ToString());
                    textBox18.Text = sdr["tnbqzyy"].ToString();
                    dateTimePicker2.Value = DateTime.Parse( sdr["gxyqzsj"].ToString());
                    textBox11.Text = sdr["gxyqzyy"].ToString();
                    dateTimePicker4.Value = DateTime.Parse( sdr["gxbqzsj"].ToString());
                    textBox19.Text = sdr["gxbqzyy"].ToString();
                    dateTimePicker5.Value = DateTime.Parse( sdr["mzfqzsj"].ToString());
                    textBox20.Text = sdr["mzfqzyy"].ToString();
                    dateTimePicker6.Value = DateTime.Parse( sdr["exzlqzsj"].ToString());
                    textBox21.Text = sdr["exzlqzyy"].ToString();
                    dateTimePicker7.Value = DateTime.Parse( sdr["nzzqzsj"].ToString());
                    textBox22.Text = sdr["nzzqzyy"].ToString();
                    dateTimePicker8.Value = DateTime.Parse( sdr["jsbqzsj"].ToString());
                    textBox23.Text = sdr["jsbqzyy"].ToString();
                    dateTimePicker9.Value = DateTime.Parse( sdr["jhbqzsj"].ToString());
                    textBox24.Text = sdr["jhbqzyy"].ToString();
                    dateTimePicker10.Value = DateTime.Parse( sdr["gyqzsj"].ToString());
                    textBox25.Text = sdr["gyqzyy"].ToString();
                    dateTimePicker11.Value = DateTime.Parse( sdr["qtcybqzsj"].ToString());
                    textBox26.Text = sdr["qtcybqzyy"].ToString();
                    textBox28.Text = sdr["qtjbm"].ToString();
                    dateTimePicker12.Value = DateTime.Parse( sdr["qtjbsj"].ToString());
                    textBox27.Text = sdr["qtjibyy"].ToString();
                    textBox29.Text = sdr["ssmz1"].ToString();
                    textBox30.Text = sdr["ssmz2"].ToString();
                    dateTimePicker13.Value = DateTime.Parse( sdr["ss1sj"].ToString());
                    dateTimePicker14.Value = DateTime.Parse( sdr["ss2sj"].ToString());
                    textBox31.Text = sdr["ss1dd"].ToString();
                    textBox32.Text = sdr["ss2dd"].ToString();
                    textBox36.Text = sdr["wsmc1"].ToString();
                    dateTimePicker16.Value = DateTime.Parse( sdr["wssj1"].ToString());
                    textBox35.Text = sdr["wsmc2"].ToString();
                    dateTimePicker15.Value = DateTime.Parse( sdr["wssj2"].ToString());
                    textBox38.Text = sdr["sxyy1"].ToString();
                    textBox37.Text = sdr["sxyy2"].ToString();
                    dateTimePicker18.Value = DateTime.Parse( sdr["sssj1"].ToString());
                    dateTimePicker17.Value = DateTime.Parse( sdr["sssj2"].ToString());
                    textBox34.Text = sdr["sxdd1"].ToString();
                    textBox33.Text = sdr["sxdd2"].ToString();

                }
                conn.Close();
                sdr.Close();

                conn.Open();
                sc = new SqlCommand("select * from personfile4" + "  where  person_healthfile_no='" + heno + "'", conn);
                sdr = sc.ExecuteReader();
                sdr.Read();
                {
                    checkBox14.Checked = (bool)sdr["fqw"];
                    checkBox15.Checked = (bool)sdr["fqgxy"];
                    checkBox16.Checked = (bool)sdr["fqtnb"];
                    checkBox17.Checked = (bool)sdr["fqgxb"];
                    checkBox18.Checked = (bool)sdr["fqmzf"];
                    checkBox20.Checked = (bool)sdr["fqexzl"];
                    checkBox21.Checked = (bool)sdr["fqnzz"];
                    checkBox23.Checked = (bool)sdr["fqjsb"];
                    checkBox24.Checked = (bool)sdr["fqjhb"];
                    checkBox19.Checked = (bool)sdr["fqgy"];
                    checkBox22.Checked = (bool)sdr["fqxtjx"];
                    checkBox25.Checked = (bool)sdr["fqqt"];
                    checkBox26.Checked = (bool)sdr["mqw"];
                    checkBox27.Checked = (bool)sdr["mqgxy"];
                    checkBox28.Checked = (bool)sdr["mqtnb"];
                    checkBox29.Checked = (bool)sdr["mqgxb"];
                    checkBox30.Checked = (bool)sdr["mqmzf"];
                    checkBox31.Checked = (bool)sdr["mqexzl"];
                    checkBox32.Checked = (bool)sdr["mqnzz"];
                    checkBox33.Checked = (bool)sdr["mqjsb"];
                    checkBox47.Checked = (bool)sdr["mqjhb"];
                    checkBox49.Checked = (bool)sdr["mqgy"];
                    checkBox48.Checked = (bool)sdr["mqxtjx"];
                    checkBox46.Checked = (bool)sdr["mqqt"];
                    checkBox45.Checked = (bool)sdr["xdw"];
                    checkBox44.Checked = (bool)sdr["xdgxy"];
                    checkBox43.Checked = (bool)sdr["xdtnb"];
                    checkBox42.Checked = (bool)sdr["xdgxb"];
                    checkBox41.Checked = (bool)sdr["xdmzf"];
                    checkBox39.Checked = (bool)sdr["xdexzl"];
                    checkBox38.Checked = (bool)sdr["xdnzz"];
                    checkBox36.Checked = (bool)sdr["xdjsb"];
                    checkBox35.Checked = (bool)sdr["xdjhb"];
                    checkBox40.Checked = (bool)sdr["xdgy"];
                    checkBox47.Checked = (bool)sdr["xdxtjx"];
                    checkBox34.Checked = (bool)sdr["xdqt"];
                    checkBox61.Checked = (bool)sdr["zvw"];
                    checkBox60.Checked = (bool)sdr["zvgxy"];
                    checkBox59.Checked = (bool)sdr["zvtnb"];
                    checkBox58.Checked = (bool)sdr["zvgxb"];
                    checkBox57.Checked = (bool)sdr["zvmzf"];
                    checkBox56.Checked = (bool)sdr["zvexzl"];
                    checkBox55.Checked = (bool)sdr["zvnzz"];
                    checkBox54.Checked = (bool)sdr["zvjsb"];
                    checkBox51.Checked = (bool)sdr["zvjhb"];
                    checkBox53.Checked = (bool)sdr["zvgy"];
                    checkBox52.Checked = (bool)sdr["zvxtjx"];
                    checkBox50.Checked = (bool)sdr["zvqt"];
                    radioButton1.Checked = (bool)sdr["ycbsw"];
                    radioButton2.Checked = (bool)sdr["ycbsy"];
                    textBox16.Text = sdr["ycbsjbmc"].ToString();
                    checkBox64.Checked = (bool)sdr["cjw"];
                    checkBox65.Checked = (bool)sdr["slcj"];
                    checkBox66.Checked = (bool)sdr["tlcj"];
                    checkBox67.Checked = (bool)sdr["yycj"];
                    checkBox68.Checked = (bool)sdr["ztcj"];
                    checkBox69.Checked = (bool)sdr["zlcj"];
                    checkBox70.Checked = (bool)sdr["jscj"];
                    checkBox71.Checked = (bool)sdr["qtcj"];
                    textBox17.Text = sdr["qtcj_nr"].ToString();          

                }

            }


            }
            catch (Exception e1)
            {
                
            }


        }
        bool one = false;//是否第一次点击
        SqlDataAdapter sda;
        DataTable dt;
        DataRow dr;
        SqlCommandBuilder scb;
        private void toolStripButton1_Click(object sender, EventArgs e)//保存
        {

            if (!one && !chakan)
            {
                try
                {
                    if (isend != "归档")
                    {
                        sda = new SqlDataAdapter("select * from person", Dbconnect.s1);
                        DataTable dtxg = new DataTable();
                        sda.Fill(dtxg);
                        dtxg.PrimaryKey = new DataColumn[] { dtxg.Columns[0] };
                        DataRow drxg = dtxg.Rows.Find(heno);
                        drxg["person_blood"] = comboBox4.Text;
                        drxg["person_tel"] = textBox7.Text;
                        drxg["person_contact"] = textBox8.Text;
                        drxg["person_contact_tel"] = textBox10.Text;
                        drxg["person_education"] = comboBox1.Text;
                        drxg["person_vocation"] = comboBox2.Text;
                        drxg["person_marryage"] = comboBox3.Text;
                        drxg["Person_rh"] = comboBox5.Text;
                        drxg["person_iscreate"] = "已建";
                        SqlCommandBuilder scbxg = new SqlCommandBuilder(sda);
                        sda.Update(new DataRow[] { drxg });

                        sda = new SqlDataAdapter("select * from personfile1", Dbconnect.s1);
                        dt = new DataTable();
                        sda.Fill(dt);
                        dt.PrimaryKey = new DataColumn[] { dt.Columns["followup_id"] };
                        dr = dt.NewRow();
                        dr["person_healthfile_no"] = heno;
                        dr["jzzh"] = textBox5.Text;
                        dr["gzdw"] = textBox6.Text;
                        dr["czzgjbyl"] = checkBox1.Checked;
                        dr["czjmjbyl"] = checkBox2.Checked;
                        dr["xxnchzyl"] = checkBox3.Checked;
                        dr["pkjz"] = checkBox4.Checked;
                        dr["syylbx"] = checkBox5.Checked;
                        dr["qgf"] = checkBox6.Checked;
                        dr["qzf"] = checkBox7.Checked;
                        dr["qt"] = checkBox8.Checked;
                        dr["qt_nr"] = textBox15.Text;
                        dr["ywgmw"] = radioButton3.Checked;
                        dr["ywgmy"] = radioButton4.Checked;
                        dr["ywgmqms"] = checkBox10.Checked;
                        dr["ywgmha"] = checkBox11.Checked;
                        dr["ywgmlms"] = checkBox12.Checked;
                        dr["ywgmqt"] = checkBox13.Checked;
                        dr["ywgmqt_nr"] = textBox15.Text;
                        dr["create_time"] = DateTime.Now.ToShortTimeString();
                        dr["class"] = "个人一般情况表";
                        dt.Rows.Add(dr);
                        scb = new SqlCommandBuilder(sda);
                        sda.Update(dt);

                        #region  保存既往史的判断
                        sda = new SqlDataAdapter("select * from personfile2", Dbconnect.s1);
                        dt = new DataTable();
                        sda.Fill(dt);
                        dt.PrimaryKey = new DataColumn[] { dt.Columns["followup_id"] };
                        dr = dt.NewRow();
                        dr["person_healthfile_no"] = heno;
                        dr["jbw"] = radioButton6.Checked;
                        dr["jby"] = radioButton7.Checked;
                        dr["gxyw"] = radioButton8.Checked;
                        dr["gxyy"] = radioButton10.Checked;
                        dr["tnbw"] = radioButton13.Checked;
                        dr["tnby"] = radioButton11.Checked;
                        dr["gxbw"] = radioButton16.Checked;
                        dr["gxby"] = radioButton15.Checked;
                        dr["mxzsxfyw"] = radioButton19.Checked;
                        dr["mxzsxfyy"] = radioButton18.Checked;
                        dr["exzlw"] = radioButton22.Checked;
                        dr["exzly"] = radioButton21.Checked;
                        dr["nzzw"] = radioButton25.Checked;
                        dr["nzzy"] = radioButton24.Checked;
                        dr["zxjsbw"] = radioButton28.Checked;
                        dr["zxjsby"] = radioButton27.Checked;
                        dr["jhbw"] = radioButton31.Checked;
                        dr["jhby"] = radioButton30.Checked;
                        dr["gyw"] = radioButton34.Checked;
                        dr["gyy"] = radioButton33.Checked;
                        dr["qtfdcybw"] = radioButton37.Checked;
                        dr["qtfdcyby"] = radioButton36.Checked;
                        dr["qtw"] = radioButton40.Checked;
                        dr["qty"] = radioButton39.Checked;
                        dr["ssw"] = radioButton41.Checked;
                        dr["ssy"] = radioButton42.Checked;
                        dr["wsw"] = radioButton44.Checked;
                        dr["wsy"] = radioButton43.Checked;
                        dr["sxw"] = radioButton46.Checked;
                        dr["sxy"] = radioButton45.Checked;
                        dt.Rows.Add(dr);
                        scb = new SqlCommandBuilder(sda);
                        sda.Update(dt);
                        #endregion

                        #region 保存既往史内容
                        sda = new SqlDataAdapter("select * from personfile3", Dbconnect.s1);
                        dt = new DataTable();
                        sda.Fill(dt);
                        dt.PrimaryKey = new DataColumn[] { dt.Columns["followup_id"] };
                        dr = dt.NewRow();
                        dr["person_healthfile_no"] = heno;
                        dr["tnbqzsj"] = dateTimePicker3.Value.ToShortTimeString();
                        dr["tnbqzyy"] = textBox18.Text;
                        dr["gxyqzsj"] = dateTimePicker2.Value.ToShortTimeString();
                        dr["gxyqzyy"] = textBox11.Text;
                        dr["gxbqzsj"] = dateTimePicker4.Value.ToShortTimeString();
                        dr["gxbqzyy"] = textBox19.Text;
                        dr["mzfqzsj"] = dateTimePicker5.Value.ToShortTimeString();
                        dr["mzfqzyy"] = textBox20.Text;
                        dr["exzlqzsj"] = dateTimePicker6.Value.ToShortTimeString();
                        dr["exzlqzyy"] = textBox21.Text;
                        dr["nzzqzsj"] = dateTimePicker7.Value.ToShortTimeString();
                        dr["nzzqzyy"] = textBox22.Text;
                        dr["jsbqzsj"] = dateTimePicker8.Value.ToShortTimeString();
                        dr["jsbqzyy"] = textBox23.Text;
                        dr["jhbqzsj"] = dateTimePicker9.Value.ToShortTimeString();
                        dr["jhbqzyy"] = textBox24.Text;
                        dr["gyqzsj"] = dateTimePicker10.Value.ToShortTimeString();
                        dr["gyqzyy"] = textBox25.Text;
                        dr["qtcybqzsj"] = dateTimePicker11.Value.ToShortTimeString();
                        dr["qtcybqzyy"] = textBox26.Text;
                        dr["qtjbm"] = textBox28.Text;
                        dr["qtjbsj"] = dateTimePicker12.Value.ToShortTimeString();
                        dr["qtjibyy"] = textBox27.Text;
                        dr["ssmz1"] = textBox29.Text;
                        dr["ssmz2"] = textBox30.Text;
                        dr["ss1sj"] = dateTimePicker13.Value.ToShortTimeString();
                        dr["ss2sj"] = dateTimePicker14.Value.ToShortTimeString();
                        dr["ss1dd"] = textBox31.Text;
                        dr["ss2dd"] = textBox32.Text;
                        dr["wsmc1"] = textBox36.Text;
                        dr["wssj1"] = dateTimePicker16.Value.ToShortTimeString();
                        dr["wsmc2"] = textBox35.Text;
                        dr["wssj2"] = dateTimePicker15.Value.ToShortTimeString();
                        dr["sxyy1"] = textBox38.Text;
                        dr["sxyy2"] = textBox37.Text;
                        dr["sssj1"] = dateTimePicker18.Value.ToShortTimeString();
                        dr["sssj2"] = dateTimePicker17.Value.ToShortTimeString();
                        dr["sxdd1"] = textBox34.Text;
                        dr["sxdd2"] = textBox33.Text;
                        dt.Rows.Add(dr);
                        scb = new SqlCommandBuilder(sda);
                        sda.Update(dt);
                        #endregion

                        #region 保存家族史
                        sda = new SqlDataAdapter("select * from personfile4", Dbconnect.s1);
                        dt = new DataTable();
                        sda.Fill(dt);
                        dt.PrimaryKey = new DataColumn[] { dt.Columns["followup_id"] };
                        dr = dt.NewRow();
                        dr["person_healthfile_no"] = heno;
                        dr["fqw"] = checkBox14.Checked;
                        dr["fqgxy"] = checkBox15.Checked;
                        dr["fqtnb"] = checkBox16.Checked;
                        dr["fqgxb"] = checkBox17.Checked;
                        dr["fqmzf"] = checkBox18.Checked;
                        dr["fqexzl"] = checkBox20.Checked;
                        dr["fqnzz"] = checkBox21.Checked;
                        dr["fqjsb"] = checkBox23.Checked;
                        dr["fqjhb"] = checkBox24.Checked;
                        dr["fqgy"] = checkBox19.Checked;
                        dr["fqxtjx"] = checkBox22.Checked;
                        dr["fqqt"] = checkBox25.Checked;
                        dr["mqw"] = checkBox26.Checked;
                        dr["mqgxy"] = checkBox27.Checked;
                        dr["mqtnb"] = checkBox28.Checked;
                        dr["mqgxb"] = checkBox29.Checked;
                        dr["mqmzf"] = checkBox30.Checked;
                        dr["mqexzl"] = checkBox31.Checked;
                        dr["mqnzz"] = checkBox32.Checked;
                        dr["mqjsb"] = checkBox33.Checked;
                        dr["mqjhb"] = checkBox47.Checked;
                        dr["mqgy"] = checkBox49.Checked;
                        dr["mqxtjx"] = checkBox48.Checked;
                        dr["mqqt"] = checkBox46.Checked;
                        dr["xdw"] = checkBox45.Checked;
                        dr["xdgxy"] = checkBox44.Checked;
                        dr["xdtnb"] = checkBox43.Checked;
                        dr["xdgxb"] = checkBox42.Checked;
                        dr["xdmzf"] = checkBox41.Checked;
                        dr["xdexzl"] = checkBox39.Checked;
                        dr["xdnzz"] = checkBox38.Checked;
                        dr["xdjsb"] = checkBox36.Checked;
                        dr["xdjhb"] = checkBox35.Checked;
                        dr["xdgy"] = checkBox40.Checked;
                        dr["xdxtjx"] = checkBox47.Checked;
                        dr["xdqt"] = checkBox34.Checked;
                        dr["zvw"] = checkBox61.Checked;
                        dr["zvgxy"] = checkBox60.Checked;
                        dr["zvtnb"] = checkBox59.Checked;
                        dr["zvgxb"] = checkBox58.Checked;
                        dr["zvmzf"] = checkBox57.Checked;
                        dr["zvexzl"] = checkBox56.Checked;
                        dr["zvnzz"] = checkBox55.Checked;
                        dr["zvjsb"] = checkBox54.Checked;
                        dr["zvjhb"] = checkBox51.Checked;
                        dr["zvgy"] = checkBox53.Checked;
                        dr["zvxtjx"] = checkBox52.Checked;
                        dr["zvqt"] = checkBox50.Checked;
                        dr["ycbsw"] = radioButton1.Checked;
                        dr["ycbsy"] = radioButton2.Checked;
                        dr["ycbsjbmc"] = textBox16.Text;
                        dr["cjw"] = checkBox64.Checked;
                        dr["slcj"] = checkBox65.Checked;
                        dr["tlcj"] = checkBox66.Checked;
                        dr["yycj"] = checkBox67.Checked;
                        dr["ztcj"] = checkBox68.Checked;
                        dr["zlcj"] = checkBox69.Checked;
                        dr["jscj"] = checkBox70.Checked;
                        dr["qtcj"] = checkBox71.Checked;
                        dr["qtcj_nr"] = textBox17.Text;
                        dt.Rows.Add(dr);
                        scb = new SqlCommandBuilder(sda);
                        sda.Update(dt);
                        #endregion

                        one = true;
                        MessageBox.Show("保存个人一般情况表成功");
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("该档案已经归档，不用再进行操作");
                    }
              
                  
                }
                catch (Exception e1)
                {
                    
                }


            }
                if (chakan)//保存修改
                {
                    try
                    {
                          if (isend != "归档")
                    {
                        sda = new SqlDataAdapter("select * from person", Dbconnect.s1);
                        DataTable dtxg = new DataTable();
                        sda.Fill(dtxg);
                        dtxg.PrimaryKey = new DataColumn[] { dtxg.Columns[0] };
                        DataRow drxg = dtxg.Rows.Find(heno);
                        drxg["person_blood"] = comboBox4.Text;
                        drxg["person_tel"] = textBox7.Text;
                        drxg["person_contact"] = textBox8.Text;
                        drxg["person_contact_tel"] = textBox10.Text;
                        drxg["person_education"] = comboBox1.Text;
                        drxg["person_vocation"] = comboBox2.Text;
                        drxg["person_marryage"] = comboBox3.Text;
                        drxg["Person_rh"] = comboBox5.Text;
                        drxg["person_iscreate"] = "已建";
                        SqlCommandBuilder scbxg = new SqlCommandBuilder(sda);
                        sda.Update(new DataRow[] { drxg });


                        sda = new SqlDataAdapter("select * from personfile1", Dbconnect.s1);
                        dt = new DataTable();
                        sda.Fill(dt);
                        dt.PrimaryKey = new DataColumn[] { dt.Columns[0] };
                        dr = dt.Rows.Find(heno);
                        dr["jzzh"] = textBox5.Text;
                        dr["gzdw"] = textBox6.Text;
                        dr["czzgjbyl"] = checkBox1.Checked;
                        dr["czjmjbyl"] = checkBox2.Checked;
                        dr["xxnchzyl"] = checkBox3.Checked;
                        dr["pkjz"] = checkBox4.Checked;
                        dr["syylbx"] = checkBox5.Checked;
                        dr["qgf"] = checkBox6.Checked;
                        dr["qzf"] = checkBox7.Checked;
                        dr["qt"] = checkBox8.Checked;
                        dr["qt_nr"] = textBox15.Text;
                        dr["ywgmw"] = radioButton3.Checked;
                        dr["ywgmy"] = radioButton4.Checked;
                        dr["ywgmqms"] = checkBox10.Checked;
                        dr["ywgmha"] = checkBox11.Checked;
                        dr["ywgmlms"] = checkBox12.Checked;
                        dr["ywgmqt"] = checkBox13.Checked;
                        dr["ywgmqt_nr"] = textBox15.Text;
                        scb = new SqlCommandBuilder(sda);
                        sda.Update(new DataRow[] { dr });

                        sda = new SqlDataAdapter("select * from personfile2", Dbconnect.s1);
                        dt = new DataTable();
                        sda.Fill(dt);
                        dt.PrimaryKey = new DataColumn[] { dt.Columns[0] };
                        dr = dt.Rows.Find(heno);
                        dr["jbw"] = radioButton6.Checked;
                        dr["jby"] = radioButton7.Checked;
                        dr["gxyw"] = radioButton8.Checked;
                        dr["gxyy"] = radioButton10.Checked;
                        dr["tnbw"] = radioButton13.Checked;
                        dr["tnby"] = radioButton11.Checked;
                        dr["gxbw"] = radioButton16.Checked;
                        dr["gxby"] = radioButton15.Checked;
                        dr["mxzsxfyw"] = radioButton19.Checked;
                        dr["mxzsxfyy"] = radioButton18.Checked;
                        dr["exzlw"] = radioButton22.Checked;
                        dr["exzly"] = radioButton21.Checked;
                        dr["nzzw"] = radioButton25.Checked;
                        dr["nzzy"] = radioButton24.Checked;
                        dr["zxjsbw"] = radioButton28.Checked;
                        dr["zxjsby"] = radioButton27.Checked;
                        dr["jhbw"] = radioButton31.Checked;
                        dr["jhby"] = radioButton30.Checked;
                        dr["gyw"] = radioButton34.Checked;
                        dr["gyy"] = radioButton33.Checked;
                        dr["qtfdcybw"] = radioButton37.Checked;
                        dr["qtfdcyby"] = radioButton36.Checked;
                        dr["qtw"] = radioButton40.Checked;
                        dr["qty"] = radioButton39.Checked;
                        dr["ssw"] = radioButton41.Checked;
                        dr["ssy"] = radioButton42.Checked;
                        dr["wsw"] = radioButton44.Checked;
                        dr["wsy"] = radioButton43.Checked;
                        dr["sxw"] = radioButton46.Checked;
                        dr["sxy"] = radioButton45.Checked;
                        scb = new SqlCommandBuilder(sda);
                        sda.Update(new DataRow[] { dr });

                        sda = new SqlDataAdapter("select * from personfile3", Dbconnect.s1);
                        dt = new DataTable();
                        sda.Fill(dt);
                        dt.PrimaryKey = new DataColumn[] { dt.Columns[0] };
                        dr = dt.Rows.Find(heno);
                        dr["tnbqzsj"] = dateTimePicker3.Value.ToShortTimeString();
                        dr["tnbqzyy"] = textBox18.Text;
                        dr["gxyqzsj"] = dateTimePicker2.Value.ToShortTimeString();
                        dr["gxyqzyy"] = textBox11.Text;
                        dr["gxbqzsj"] = dateTimePicker4.Value.ToShortTimeString();
                        dr["gxbqzyy"] = textBox19.Text;
                        dr["mzfqzsj"] = dateTimePicker5.Value.ToShortTimeString();
                        dr["mzfqzyy"] = textBox20.Text;
                        dr["exzlqzsj"] = dateTimePicker6.Value.ToShortTimeString();
                        dr["exzlqzyy"] = textBox21.Text;
                        dr["nzzqzsj"] = dateTimePicker7.Value.ToShortTimeString();
                        dr["nzzqzyy"] = textBox22.Text;
                        dr["jsbqzsj"] = dateTimePicker8.Value.ToShortTimeString();
                        dr["jsbqzyy"] = textBox23.Text;
                        dr["jhbqzsj"] = dateTimePicker9.Value.ToShortTimeString();
                        dr["jhbqzyy"] = textBox24.Text;
                        dr["gyqzsj"] = dateTimePicker10.Value.ToShortTimeString();
                        dr["gyqzyy"] = textBox25.Text;
                        dr["qtcybqzsj"] = dateTimePicker11.Value.ToShortTimeString();
                        dr["qtcybqzyy"] = textBox26.Text;
                        dr["qtjbm"] = textBox28.Text;
                        dr["qtjbsj"] = dateTimePicker12.Value.ToShortTimeString();
                        dr["qtjibyy"] = textBox27.Text;
                        dr["ssmz1"] = textBox29.Text;
                        dr["ssmz2"] = textBox30.Text;
                        dr["ss1sj"] = dateTimePicker13.Value.ToShortTimeString();
                        dr["ss2sj"] = dateTimePicker14.Value.ToShortTimeString();
                        dr["ss1dd"] = textBox31.Text;
                        dr["ss2dd"] = textBox32.Text;
                        dr["wsmc1"] = textBox36.Text;
                        dr["wssj1"] = dateTimePicker16.Value.ToShortTimeString();
                        dr["wsmc2"] = textBox35.Text;
                        dr["wssj2"] = dateTimePicker15.Value.ToShortTimeString();
                        dr["sxyy1"] = textBox38.Text;
                        dr["sxyy2"] = textBox37.Text;
                        dr["sssj1"] = dateTimePicker18.Value.ToShortTimeString();
                        dr["sssj2"] = dateTimePicker17.Value.ToShortTimeString();
                        dr["sxdd1"] = textBox34.Text;
                        dr["sxdd2"] = textBox33.Text;
                        scb = new SqlCommandBuilder(sda);
                        sda.Update(new DataRow[] { dr });

                        sda = new SqlDataAdapter("select * from personfile4", Dbconnect.s1);
                        dt = new DataTable();
                        sda.Fill(dt);
                        dt.PrimaryKey = new DataColumn[] { dt.Columns[0] };
                        dr = dt.Rows.Find(heno);
                        dr["fqw"] = checkBox14.Checked;
                        dr["fqgxy"] = checkBox15.Checked;
                        dr["fqtnb"] = checkBox16.Checked;
                        dr["fqgxb"] = checkBox17.Checked;
                        dr["fqmzf"] = checkBox18.Checked;
                        dr["fqexzl"] = checkBox20.Checked;
                        dr["fqnzz"] = checkBox21.Checked;
                        dr["fqjsb"] = checkBox23.Checked;
                        dr["fqjhb"] = checkBox24.Checked;
                        dr["fqgy"] = checkBox19.Checked;
                        dr["fqxtjx"] = checkBox22.Checked;
                        dr["fqqt"] = checkBox25.Checked;
                        dr["mqw"] = checkBox26.Checked;
                        dr["mqgxy"] = checkBox27.Checked;
                        dr["mqtnb"] = checkBox28.Checked;
                        dr["mqgxb"] = checkBox29.Checked;
                        dr["mqmzf"] = checkBox30.Checked;
                        dr["mqexzl"] = checkBox31.Checked;
                        dr["mqnzz"] = checkBox32.Checked;
                        dr["mqjsb"] = checkBox33.Checked;
                        dr["mqjhb"] = checkBox47.Checked;
                        dr["mqgy"] = checkBox49.Checked;
                        dr["mqxtjx"] = checkBox48.Checked;
                        dr["mqqt"] = checkBox46.Checked;
                        dr["xdw"] = checkBox45.Checked;
                        dr["xdgxy"] = checkBox44.Checked;
                        dr["xdtnb"] = checkBox43.Checked;
                        dr["xdgxb"] = checkBox42.Checked;
                        dr["xdmzf"] = checkBox41.Checked;
                        dr["xdexzl"] = checkBox39.Checked;
                        dr["xdnzz"] = checkBox38.Checked;
                        dr["xdjsb"] = checkBox36.Checked;
                        dr["xdjhb"] = checkBox35.Checked;
                        dr["xdgy"] = checkBox40.Checked;
                        dr["xdxtjx"] = checkBox47.Checked;
                        dr["xdqt"] = checkBox34.Checked;
                        dr["zvw"] = checkBox61.Checked;
                        dr["zvgxy"] = checkBox60.Checked;
                        dr["zvtnb"] = checkBox59.Checked;
                        dr["zvgxb"] = checkBox58.Checked;
                        dr["zvmzf"] = checkBox57.Checked;
                        dr["zvexzl"] = checkBox56.Checked;
                        dr["zvnzz"] = checkBox55.Checked;
                        dr["zvjsb"] = checkBox54.Checked;
                        dr["zvjhb"] = checkBox51.Checked;
                        dr["zvgy"] = checkBox53.Checked;
                        dr["zvxtjx"] = checkBox52.Checked;
                        dr["zvqt"] = checkBox50.Checked;
                        dr["ycbsw"] = radioButton1.Checked;
                        dr["ycbsy"] = radioButton2.Checked;
                        dr["ycbsjbmc"] = textBox16.Text;
                        dr["cjw"] = checkBox64.Checked;
                        dr["slcj"] = checkBox65.Checked;
                        dr["tlcj"] = checkBox66.Checked;
                        dr["yycj"] = checkBox67.Checked;
                        dr["ztcj"] = checkBox68.Checked;
                        dr["zlcj"] = checkBox69.Checked;
                        dr["jscj"] = checkBox70.Checked;
                        dr["qtcj"] = checkBox71.Checked;
                        dr["qtcj_nr"] = textBox17.Text;
                        scb = new SqlCommandBuilder(sda);
                        sda.Update(new DataRow[] { dr });
                    }
                    else
                    {
                        MessageBox.Show("该档案已经归档，不用再进行操作");
                    }
                    }
                    catch (Exception e1)
                    {
                        
                    }
                    }
                     

            
                
        }

       
    }
}